<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件修饰符</title>
  <script src="../vue.js"></script>
  <style>
    .fa {
      width: 400px;
      height: 400px;
      background-color: red;
    }

    .son {
      width: 200px;
      height: 200px;
      background-color: green;
    }
  </style>
</head>

<body>
  <div id="app">
    <div class="fa" @click="btn1">
      <!-- 阻止事件冒泡 -->
      <div class="son" @click.stop="btn2"></div>
      <!-- <div class="son" @mouseenter="btn2"></div> -->

    </div>
    <!-- 阻止事件默认行为 -->
    <a @click.prevent="btn3" href="https://www.baidu.com/?tn=40020637_9_oem_dg">百度</a>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {

      },
      methods: {
        btn2() {
          alert(2)
        },
        btn1() {
          alert(1)
        },
        btn3() {
          alert(3)
        }
      }
    })
  </script>
</body>

</html>